Skip to content

[1d4] chess index and query system POC#956

Merged
aaylward merged 7 commits intomainfrom
one_shot_chess_indexer_claude
Feb 1, 2026
Merged

[1d4] chess index and query system POC#956
aaylward merged 7 commits intomainfrom
one_shot_chess_indexer_claude

Conversation

@aaylward
Copy link
Collaborator

@aaylward aaylward commented Jan 28, 2026

Chess Game Indexer with ChessQL Query Language

Adds a chess game indexing service that fetches games from chess.com, extracts tactical motifs (pins, forks, skewers, etc.), and provides a
SQL-like query language (ChessQL) for searching.

Features

Indexing Pipeline

  • Fetches games from chess.com API by player and date range
  • Parses PGN, replays positions using chariot library
  • Detects 5 tactical motifs: pin, cross-pin, fork, skewer, discovered attack
  • Stores game metadata and motif flags in H2 (in-process) or PostgreSQL

ChessQL Query Language

  • SQL-like syntax: white.elo > 2500 AND motif(fork)
  • Supports comparisons, IN clauses, boolean operators, motif functions
  • Compiles to parameterized SQL (injection-safe)

In-Process Mode

  • Runs with zero external dependencies using H2 in-memory database
  • Useful for local dev, testing, CLI tooling, and demos

API

Index games

POST /index {"player":"hikaru","platform":"CHESS_COM","startMonth":"2026-01","endMonth":"2026-01"}

Check status

GET /index/{id}

Query with ChessQL

POST /query {"query":"motif(pin) AND white.elo > 2700","limit":10,"offset":0}

Architecture

HTTP API → InMemoryQueue → IndexWorker → H2/PostgreSQL

FeatureExtractor → MotifDetectors

Test Coverage

  • ChessQL: lexer, parser, SQL compiler
  • Engine: PGN parser
  • Motifs: fork, pin, skewer detectors
  • Worker: result mapping (1-0, 0-1, 1/2-1/2)
  • Queue: in-memory implementation

Documentation

  • docs/API.md - REST API reference
  • docs/CHESSQL.md - Query language grammar
  • docs/DESIGN.md - Architecture overview
  • docs/IN_PROCESS_MODE.md - Local development guide
  • docs/ROADMAP.md - Future phases (validation, resilience, SQS, security)

Running Locally

INDEXER_DB_URL="jdbc:h2:mem:indexer;DB_CLOSE_DELAY=-1"
bazel run //jvm/src/main/java/com/muchq/indexer:indexer

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 29, 2026

Deploying moonbase-flippy-mem with  Cloudflare Pages  Cloudflare Pages

Latest commit: a094cc7
Status: ✅  Deploy successful!
Preview URL: https://3371eebb.moonbase-4zv.pages.dev
Branch Preview URL: https://one-shot-chess-indexer-claud.moonbase-4zv.pages.dev

View logs

@aaylward aaylward changed the title one shot claude chess index and query system [1d4] chess index and query system POC Feb 1, 2026
@aaylward aaylward marked this pull request as ready for review February 1, 2026 04:46
@aaylward aaylward enabled auto-merge (squash) February 1, 2026 04:46
@aaylward aaylward disabled auto-merge February 1, 2026 04:49
@aaylward aaylward enabled auto-merge (squash) February 1, 2026 04:49
@aaylward aaylward merged commit 5966fd3 into main Feb 1, 2026
9 checks passed
@aaylward aaylward deleted the one_shot_chess_indexer_claude branch February 1, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant